package com.example.mybatis.controller;


import com.example.mybatis.bean.QuestionBan;

import com.example.mybatis.service.FileService;
import com.example.mybatis.service.QuestionBanService;
import com.example.mybatis.utils.ResultUtil;
import com.example.mybatis.utils.validator.DataValidator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("questionBank")
public class QuestionBanController {

    @Resource
    QuestionBanService questionBanService;



/*    @RequestMapping("selectList")
    public ResultUtil selectList(String matter,String id) {
        return questionBanService.selectList(matter,id);

    }*/

    @RequestMapping("insert")
    public ResultUtil insert(QuestionBan questionBan) {
        DataValidator.validator(questionBan);
        return questionBanService.insert(questionBan);


    }

    @RequestMapping("getById")
    public ResultUtil getById(Integer id,Integer catalogueId) {
        return questionBanService.getById(id,catalogueId);


    }

    @RequestMapping("update")
    public ResultUtil update(QuestionBan questionBan) {
        return questionBanService.update(questionBan);
    }

    @RequestMapping("removeById")
    public ResultUtil removeById(Integer id) {
        return questionBanService.removeById(id);
    }


    @RequestMapping("selectAll")
    public ResultUtil selectAll(Integer current,Integer size,String matter,Integer id){

        return questionBanService.selectAll(current, size,matter,id);
    }


}
